package com.dao;

import com.entity.HousingEstate;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface HousingEstateMapper {
    /**
     * 获得HousingEstate数据的总行数
     *
     * @return
     */
    long getHousingEstateRowCount();

    /**
     * 1.查询所有小区信息
     * 获得HousingEstate数据集合
     *
     * @return
     */
    List<HousingEstate> selectHousingEstate();

    /**
     * 获得一个HousingEstate对象,以参数HousingEstate对象中不为空的属性作为条件进行查询
     *
     * @param obj
     * @return
     */
    HousingEstate selectHousingEstateByObj(HousingEstate obj);

    /**
     * 通过HousingEstate的id获得HousingEstate对象
     *
     * @param id
     * @return
     */
    //获取小区详细信息
    HousingEstate selectHousingEstateById(Integer id);

    /**
     * 插入HousingEstate中属性值不为null的数据到数据库
     *
     * @param value
     * @return
     */
    int insertNonEmptyHousingEstate(HousingEstate value);

    /**
     * 批量插入HousingEstate到数据库,包括null值
     *
     * @param value
     * @return
     */
    int insertHousingEstateByBatch(List<HousingEstate> value);

    /**
     * 通过HousingEstate的id删除HousingEstate
     *
     * @param id
     * @return
     */
    int deleteHousingEstateById(Integer id);

    /**
     * 通过HousingEstate的id更新HousingEstate中的数据,包括null值
     *
     * @param
     * @return
     */

    int updateHousingEstateById(HousingEstate housingEstate);

    /**
     * 1.分页获取小区列表
     *
     * @param search
     * @param subSQL
     * @return
     */
    List<HousingEstate> getPageList(@Param("search") String search, @Param("subSQL") String subSQL);

    /**
     * 2.插入HousingEstate到数据库,包括null值
     *
     * @param value
     * @return
     */
    //添加小区信息
    int insertHousingEstate(HousingEstate value);


    /**
     * 通过HousingEstate的id更新HousingEstate中属性不为null的数据
     *
     * @param
     * @return
     */
    //3.修改信息
    int updateNonEmptyHousingEstateById(HousingEstate housingEstate);

    /**
     * 多条删除小区信息
     *
     * @param idList
     * @return
     */
    int deleteByPrimaryKeys(@Param("idList") List<Integer> idList);

    //通过小区编码,获取小区名字和详细地址
    String selectNameByCode(String code);


    //根据code获取address和省code和市code
    HousingEstate selectHousingEstateByCode(String housCode);

//	根据省code和市code获取省市信息

    String getPrivinceByCode(String province_code);

    String getCityByCode(String city_code);


}